"""Definition of the Comercial content type
"""

from zope.app.component.hooks import getSite
from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

from AccessControl import ClassSecurityInfo

from cintra.types.content import cintrauser
from cintra.types.interfaces import IComercial
from cintra.types.config import PROJECTNAME
from cintra.types.content.schemas.comercial import ComercialSchema

from cintra.policy.utils.roles import COMERCIAL_GROUP


class Comercial(cintrauser.CINTRAUser):
    """Comercial type for Cintra website"""
    implements(IComercial)

    meta_type = "Comercial"
    schema = ComercialSchema
    
    security = ClassSecurityInfo()    
    
    def getGroup(self):
        return COMERCIAL_GROUP    

    def get_home_url(self):
        portal = getSite()
        return portal.absolute_url_path() + '/view'


    def at_post_create_script(self):
        cintrauser.CINTRAUser.at_post_create_script(self)
#        self.setSignPassword('senha1') 


atapi.registerType(Comercial, PROJECTNAME)
